package com.xmh.myutil.service.impl;

import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xmh.myutil.dao.UserQianmeiDAO;
import com.xmh.myutil.entity.UserQianmeiEntity;
import com.xmh.myutil.service.UserQianmeiService;

@Service
public class UserQianmeiServiceImpl implements UserQianmeiService {

    @Autowired
    private UserQianmeiDAO dao;

    private Logger logger = LoggerFactory.getLogger(UserQianmeiServiceImpl.class);

    @Override
    public Map<String, Object> add(UserQianmeiEntity userQianmei) {
        dao.add(userQianmei);
        return successMessages();
    }

    @Override
    public Map<String, Object> delete(UserQianmeiEntity userQianmei) {
        dao.delete(userQianmei);
        return successMessages();
    }

    @Override
    public Map<String, Object> update(UserQianmeiEntity userQianmei) {
        dao.update(userQianmei);
        return successMessages();
    }

    @Override
    public List<UserQianmeiEntity> selectList(Map<String, Object> jsonMap) {
        return dao.selectList(jsonMap);
    }

    @Override
    public UserQianmeiEntity get(UserQianmeiEntity userQianmei) {
        return dao.get(userQianmei);
    }

    /**
     * 返回成功提示
     *
     * @return
     */
    private Map<String, Object> successMessages() {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("code", "200");
        map.put("msg", "成功");
        return map;
    }

}
